#ifndef ODN_SCENE_CAMERA_H
#define ODN_SCENE_CAMERA_H

#include "odn_util_Vector3D.h"

//Default values 
#define DEF_MAX_SCROLL_SPEED 1.0f
#define DEF_SCROLL_ACCEL 1.0f

using ouden::utility::Vector3D;

namespace ouden
{
	namespace scene
	{
		
		//NOTE An instance of this will be contained inside the scene class and from there it can be accessed directly, but it will 
		//be automatically updated as a scene element so there is no need to worry about it at all 
		class ODN_Camera : public ODN_SceneElement 
		{
			
		public:
			
			//Constructor initialises variables to defaults
			ODN_Camera() : needtomove(false), maxscrollspeed(DEF_MAX_SCROLL_SPEED), scrollaccel(DEF_SCROLL_ACCEL) 		{}
			~ODN_Camera() 		{}
			
			//Update the motion of the camera
			//Called by scene
			virtual bool Update();
			
			//TODO: Applies matrix transformations to renderer 
			virtual bool Draw()		{}
			
			//Scrolls the camera to center over the desired position 
			void lookAt(Vector3D Pos);
			
			//Centers the camera over the desired position 
			void lookAtNow(Vector3D Pos);
			
			//Property access functions 
			void setViewSize(Vector3D Size)			{ viewsize = Size; }
			void setMaxScrollSpeed(float Speed)		{ maxscrollspeed = Speed; } 
			void setScrollAccel(float Accel)		{ scrollaccel = Accel; } 
			
		private:
			
			//Accelerate the scroll speed
			void updateSpeed();
			
			//Current offset of camera scrolling 
			Vector3D scroll;
			
			//Destination for camera scrolling  
			Vector3D destination;
			
			//Speed at which the camera is scrolling 
			float scrollspeed;
			
			//Size of viewable screen as a radius, half width, half height 
			Vector3D viewsize;
			
			//Maximum speed at which the camera scrolls to change position 
			float maxscrollspeed;
			
			//Acceleration of the camera scroll 
			float scrollaccel;
			
			//Is the camera at its destination?
			bool needtomove;
			
		};
		
	} //namespace scene
} //namespace ouden

#endif //ODN_SCENE_CAMERA_H
